<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>ReflectionEnum 类</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="reflectionclassconstant.tostring.html">« ReflectionClassConstant::__toString</a></li>
      <li style="float: right;"><a href="reflectionenum.construct.html">ReflectionEnum::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.reflection.html">反射</a></li>
    <li>ReflectionEnum 类</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.reflectionenum" class="reference">
 <h1 class="title">ReflectionEnum 类</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 8 &gt;= 8.1.0)</p>

  
  <div class="section" id="reflectionenum.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    <span class="classname"><strong class="classname">ReflectionEnum</strong></span> 类报告有关 Enum 的信息。
   </p>
  </div>
  

  <div class="section" id="reflectionenum.synopsis">
   <h2 class="title">类摘要</h2>

   
   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">ReflectionEnum</strong>
     </span>

     <span class="ooclass">
      <span class="modifier">extends</span>
       <a href="class.reflectionclass.html" class="classname">ReflectionClass</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.reflectionclass.html#reflectionclass.constants.is-implicit-abstract"><var class="varname">ReflectionClass::IS_IMPLICIT_ABSTRACT</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.reflectionclass.html#reflectionclass.constants.is-explicit-abstract"><var class="varname">ReflectionClass::IS_EXPLICIT_ABSTRACT</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.reflectionclass.html#reflectionclass.constants.is-final"><var class="varname">ReflectionClass::IS_FINAL</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.reflectionclass.html#reflectionclass.constants.is-readonly"><var class="varname">ReflectionClass::IS_READONLY</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的属性 */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.reflectionclass.html#reflectionclass.props.name">$<var class="varname">name</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="reflectionenum.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><span class="type">object</span>|<span class="type">string</span></span> <code class="parameter">$objectOrClass</code></span>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionenum.getbackingtype.html" class="methodname">getBackingType</a></span>(): <span class="type"><span class="type">?</span><span class="type"><a href="class.reflectionnamedtype.html" class="type ReflectionNamedType">ReflectionNamedType</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionenum.getcase.html" class="methodname">getCase</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type"><a href="class.reflectionenumunitcase.html" class="type ReflectionEnumUnitCase">ReflectionEnumUnitCase</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionenum.getcases.html" class="methodname">getCases</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionenum.hascase.html" class="methodname">hasCase</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionenum.isbacked.html" class="methodname">isBacked</a></span>(): <span class="type">bool</span></div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><a href="reflectionclass.export.html" class="methodname">ReflectionClass::export</a></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$argument</code></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$return</code><span class="initializer"> = <strong><code>false</code></strong></span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getattributes.html" class="methodname">ReflectionClass::getAttributes</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$name</code><span class="initializer"> = <strong><code>null</code></strong></span></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getconstant.html" class="methodname">ReflectionClass::getConstant</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getconstants.html" class="methodname">ReflectionClass::getConstants</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$filter</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getconstructor.html" class="methodname">ReflectionClass::getConstructor</a></span>(): <span class="type"><span class="type">?</span><span class="type"><a href="class.reflectionmethod.html" class="type ReflectionMethod">ReflectionMethod</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getdefaultproperties.html" class="methodname">ReflectionClass::getDefaultProperties</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getdoccomment.html" class="methodname">ReflectionClass::getDocComment</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getendline.html" class="methodname">ReflectionClass::getEndLine</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getextension.html" class="methodname">ReflectionClass::getExtension</a></span>(): <span class="type"><span class="type">?</span><span class="type"><a href="class.reflectionextension.html" class="type ReflectionExtension">ReflectionExtension</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getextensionname.html" class="methodname">ReflectionClass::getExtensionName</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getfilename.html" class="methodname">ReflectionClass::getFileName</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getinterfacenames.html" class="methodname">ReflectionClass::getInterfaceNames</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getinterfaces.html" class="methodname">ReflectionClass::getInterfaces</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getmethod.html" class="methodname">ReflectionClass::getMethod</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type"><a href="class.reflectionmethod.html" class="type ReflectionMethod">ReflectionMethod</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getmethods.html" class="methodname">ReflectionClass::getMethods</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$filter</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getmodifiers.html" class="methodname">ReflectionClass::getModifiers</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getname.html" class="methodname">ReflectionClass::getName</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getnamespacename.html" class="methodname">ReflectionClass::getNamespaceName</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getparentclass.html" class="methodname">ReflectionClass::getParentClass</a></span>(): <span class="type"><span class="type"><a href="class.reflectionclass.html" class="type ReflectionClass">ReflectionClass</a></span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getproperties.html" class="methodname">ReflectionClass::getProperties</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$filter</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getproperty.html" class="methodname">ReflectionClass::getProperty</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type"><a href="class.reflectionproperty.html" class="type ReflectionProperty">ReflectionProperty</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getreflectionconstant.html" class="methodname">ReflectionClass::getReflectionConstant</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type"><span class="type"><a href="class.reflectionclassconstant.html" class="type ReflectionClassConstant">ReflectionClassConstant</a></span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getreflectionconstants.html" class="methodname">ReflectionClass::getReflectionConstants</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$filter</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getshortname.html" class="methodname">ReflectionClass::getShortName</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getstartline.html" class="methodname">ReflectionClass::getStartLine</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getstaticproperties.html" class="methodname">ReflectionClass::getStaticProperties</a></span>(): <span class="type"><span class="type">?</span><span class="type">array</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.getstaticpropertyvalue.html" class="methodname">ReflectionClass::getStaticPropertyValue</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter reference">&$def_value</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.gettraitaliases.html" class="methodname">ReflectionClass::getTraitAliases</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.gettraitnames.html" class="methodname">ReflectionClass::getTraitNames</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.gettraits.html" class="methodname">ReflectionClass::getTraits</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.hasconstant.html" class="methodname">ReflectionClass::hasConstant</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.hasmethod.html" class="methodname">ReflectionClass::hasMethod</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.hasproperty.html" class="methodname">ReflectionClass::hasProperty</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.implementsinterface.html" class="methodname">ReflectionClass::implementsInterface</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.reflectionclass.html" class="type ReflectionClass">ReflectionClass</a></span>|<span class="type">string</span></span> <code class="parameter">$interface</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.innamespace.html" class="methodname">ReflectionClass::inNamespace</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isabstract.html" class="methodname">ReflectionClass::isAbstract</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isanonymous.html" class="methodname">ReflectionClass::isAnonymous</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.iscloneable.html" class="methodname">ReflectionClass::isCloneable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isenum.html" class="methodname">ReflectionClass::isEnum</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isfinal.html" class="methodname">ReflectionClass::isFinal</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isinstance.html" class="methodname">ReflectionClass::isInstance</a></span>(<span class="methodparam"><span class="type">object</span> <code class="parameter">$object</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isinstantiable.html" class="methodname">ReflectionClass::isInstantiable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isinterface.html" class="methodname">ReflectionClass::isInterface</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isinternal.html" class="methodname">ReflectionClass::isInternal</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isiterable.html" class="methodname">ReflectionClass::isIterable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isreadonly.html" class="methodname">ReflectionClass::isReadOnly</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.issubclassof.html" class="methodname">ReflectionClass::isSubclassOf</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.reflectionclass.html" class="type ReflectionClass">ReflectionClass</a></span>|<span class="type">string</span></span> <code class="parameter">$class</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.istrait.html" class="methodname">ReflectionClass::isTrait</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.isuserdefined.html" class="methodname">ReflectionClass::isUserDefined</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.newinstance.html" class="methodname">ReflectionClass::newInstance</a></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">...$args</code></span>): <span class="type">object</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.newinstanceargs.html" class="methodname">ReflectionClass::newInstanceArgs</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$args</code><span class="initializer"> = []</span></span>): <span class="type"><span class="type">?</span><span class="type">object</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.newinstancewithoutconstructor.html" class="methodname">ReflectionClass::newInstanceWithoutConstructor</a></span>(): <span class="type">object</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.setstaticpropertyvalue.html" class="methodname">ReflectionClass::setStaticPropertyValue</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="reflectionclass.tostring.html" class="methodname">ReflectionClass::__toString</a></span>(): <span class="type">string</span></div>

   }</div>
   

  </div>

  <div class="section" id="reflectionenum.seealso">
   <h2 class="title">参见</h2>
   <p class="para">
    <ul class="simplelist">
     <li class="member"><a href="language.enumerations.html" class="link">枚举</a></li>
    </ul>
   </p>
  </div>

 </div>

 

































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="reflectionenum.construct.html">ReflectionEnum::__construct</a> — 实例化 ReflectionEnum 对象</li><li><a href="reflectionenum.getbackingtype.html">ReflectionEnum::getBackingType</a> — 获取枚举回退的类型</li><li><a href="reflectionenum.getcase.html">ReflectionEnum::getCase</a> — 返回指定的枚举条目</li><li><a href="reflectionenum.getcases.html">ReflectionEnum::getCases</a> — 返回枚举中的所有条目的清单</li><li><a href="reflectionenum.hascase.html">ReflectionEnum::hasCase</a> — 在枚举上检测条目</li><li><a href="reflectionenum.isbacked.html">ReflectionEnum::isBacked</a> — 检测 Enum 是否为回退（Backed）Enum</li></ul>
</div>
</div></div></body></html>